
#ifndef CONTROLLER_MAIN_H
#define CONTROLLER_MAIN_H

#include <vector>
#include <string>

#include "mvc/mycontroller.h"
#include "mvc/mystate.h"

#include "gui/state_normal.h"
#include "gui/state_newmem.h"

class ControlMain: public MyController {

  private:
    std::vector<MyController*> temps;
    StateNormal<ControlMain> normal_state;
    StateNewMem<ControlMain> new_member_state;
    MyState<ControlMain>* curr_state;

  public:
    ControlMain() {
        normal_state.setParent(this);
        new_member_state.setParent(this);
        curr_state = &normal_state;
    }

    std::vector<MyController*>* getTemps() {return &temps;}

    // ------------------ virtual -------------------- //
    virtual void processEvent(ALLEGRO_EVENT* ev) {
        std::string result = curr_state->processEvent(ev);

        if(result == "normal") {curr_state = &normal_state;}
        else if(result == "new member") {curr_state = &new_member_state;}
    }

    virtual bool insideMe(int x, int y) {
        /*  insert code here to determine if event occured inside this
            controller's view */

        return true;
    }
};

#endif


